home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 22.8 KB | 584 lines | [TEXT/MPS ] |
- /*
- File: FileManagerSPI.idl
-
- Contains: FileManager extended interface
-
- Version: Technology: System 8
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __FILEMANAGERSPI_IDL__
- #define __FILEMANAGERSPI_IDL__
-
- #include <somobj.idl>
- #include <somcls.idl>
-
- #ifndef __KERNEL_IDL__
- #include <Kernel.idl>
- #endif
- #ifndef __FILEMANAGERTYPES_IDL__
- #include <FileManagerTypes.idl>
- #endif
- #ifndef __FILES_IDL__
- #include <Files.idl>
- #endif
-
- #ifdef __SOMIDL__
-
- /* You can use FileManager.h or FileManagerSPI.h, but not both */
- #ifndef __FILEMANAGER__
- #if FOR_SYSTEM8_PREEMPTIVE
- /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> C O N T A I N E R S <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
- /*
- ****************************************************************************
- OBJECTS
- ****************************************************************************
- */
- /*
- Function: FSObjectRefClone
- Purpose: Return a copy of an FSObjectRef such that the copy also needs to be disposed.
- Inputs:
- object_t The object ref to be cloned.
- Outputs:
- clone_o Copy of object_t.
- Notes:
- The value returned is the same value passed as input in object_t. This call
- would typically be used to balance a future call to FSObjectRefDispose. Some
- examples where it might be used:
- • A called procedure needs to save an FSObjectRef for future use, but the
- calling conventions dictate that the caller is responsible for disposing
- of the ref. The called function could call FSObjectRefClone to make its
- copy. The caller can safely dispose of the ref, yet the callee can use
- the ref until doing its own dispose.
- • In object-oriented programming, an object could be passed an FSObjectRef
- in its constructor. The destructor would be expected to dispose the ref,
- but so would the routine that created the object. FSObjectRefClone could
- be used in the constructor.
-
- The returned FSObjectRef is registered to the calling process (as must object_t).
- */
- /*
- Function: FSObjectRefDispose
- Purpose: Dispose of an FSObjectRef previously returned to a process.
- Inputs:
- object_t The object ref to be disposed.
- Outputs:
- Notes:
- A process must dispose of all FSObjectRefs returned to it. The FSObjectRefs
- may be returned as explicit output parameters, or as properties. If a ref
- is returned several times for a given object, it must be disposed for each
- time it was returned.
-
- When all refs to a given object are disposed, the File Manager will dispose
- of any resources it allocated in order to operate on that object. All refs
- for a process will be automatically disposed upon process termination.
-
- For refs returned as properties (especially when iterating over muliple
- objects), the FSObjectRefDisposeBulk call may be more convenient.
- */
- /*
- Function: FSObjectRefDisposeBulk
- Purpose: Dispose of many FSObjectRefs, using a list of property descriptors.
- (Typically used to dispose all refs returned by FSObjectIterate).
- Inputs:
- objectCount_i Number of objects returned by FSObjectIterate.
- propertyCount_i Number of properties per object, as passed to FSObjectIterate.
- statusBuffer_i Status buffer as returned by FSObjectIterate.
- properties_i List of property descriptors passed to FSObjectIterate.
- propertiesBuffer_i Buffer where property values were returned by FSObjectIterate.
- Outputs:
- statusBuffer_o Error status for each property of each object.
- Notes:
- This call is intended to make it easy to dispose of FSObjectRefs returned by an
- FSObjectIterate call. You would pass the same property count, property descriptor
- list and property value buffer as was passed to FSObjectIterate. You also pass the
- object count and status buffer as returned by FSObjectIterate (since these tell which
- properties were actually returned).
-
- Any property in properties_i that does not contain an FSObjectRef is ignored. Any
- property that does not have E_NoError in its propertyStatus field (in statusBuffer_i)
- is ignored.
-
- All elements of statusBuffer_o will be set. If the property was ignored (as described
- above), then its propertyStatus is set to E_NoError; otherwise, it is set based on the
- attempt to dispose of the ref. The propertyValueActualSize fields are all set to 0.
-
- */
- /**/
- /*
- Function: FSObjectRefRegister
- Purpose: Allow an FSObjectRef to be used by another process.
- Inputs:
- senderObject_t The object ref.
- receiverPid_i The other process that will be using senderObject_t.
- Outputs:
- Notes:
- This call allows one process to send an FSObjectRef to another process
- such that the other process can use the FSObjectRef itself. The process
- specified by receiverPid_i must also dispose of senderObject_t. The File
- Manager acts as if senderObject_t has been returned to receiverPid_i.
-
-
-
-
-
- You might use this call if you have several processes where one process
- (typically a server of some kind) obtains FSObjectRefs for use by other
- processes (typically clients of that server). If the other process (as
- specified by receiverPid_i) won't actually call the File Manager with
- that FSObjectRef, then it doesn't need to be registered to that process.
-
- It would also be possible to have the server process make all of the
- calls to the File Manager. FSObjectRefs could still be passed between
- client and server, but if the clients never use the refs directly, then
- there would be no need to register the refs to those clients. (But beware:
- the server would still be responsible for disposing of all refs returned to
- it; the server would probably have some cleanup and disposal to do if one
- of its client processes were to terminate.)
- */
- /*
- ============================================================================
- Volume Sets
- ============================================================================
- */
- /*
- Function: FSVolumeSetGetInformation
- Purpose: Returns an FSObjectRef for a Volume Set specified by an
- FSVolumeSetObjID.
- Inputs:
- volumeSet_t The volume set.
- Outputs:
- object_o Object ref for the volume set.
- includesBootVolume_o True if the volume set includes the boot volume.
- Notes:
- There is currently only one volume set. In the future there could be others
- (perhaps file servers; perhaps to support multiple local users).
- */
- /*
- ============================================================================
- Volumes
- ============================================================================
- */
- /**/
- /* */
- /* */
- /*
- ============================================================================
- Folders
- ============================================================================
- */
- /* */
- /*
- ============================================================================
- Files
- ============================================================================
- */
- /* */
- /*
- ============================================================================
- Folder and File Requests
- ============================================================================
- */
- /**/
- /*
- Function: FSObjectDelete
- Purpose: Deletes an object. The FSObjectRef is NOT disposed; you must still dispose it yourself.
- Further attempts to use the ref will return errors (such as E_ObjectNotFound).
-
- Inputs:
- object_t The object to be deleted.
- Outputs:
- */
- /**/
- /*
- ****************************************************************************
- PROPERTIES
- ****************************************************************************
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Properties
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /**/
- /**/
- /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> C a p a b i l i t i e s <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
- /*
- ****************************************************************************
- PROPERTY ACCESS METHODS
- ****************************************************************************
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Property Simple Values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /**/
- /**/
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Property Fork Values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /*
- ============================================================================
- Stream-based Access Method
- ============================================================================
- */
- /* */
- /*
- Function: FSStreamClose
- Purpose: Close a stream previously opened with FSStreamOpen or FSStreamOpenWithConstraints.
- Inputs:
- stream_t The stream to close.
- Outputs:
- Notes:
- Any data written to the stream is flushed (written by the File Manager) before the
- stream is closed. The FSStreamObjID, stream_t, may no longer be used. Any resources
- allocated by the File Manager for use by this stream will be disposed.
- */
- /*
- Function: FSStreamFlush
- Purpose: Any data written to the stream will be written by the File Manager.
- Inputs:
- stream_t The stream to flush.
- Outputs:
- Notes:
- Stream data may still reside in the File Manager's caches, but any changes will have
- been written out by the File Manager. Note that the underlying device's driver, or
- the device itself, may cache some data, so the File Manager cannot guarantee that
- all data has actually been written to the underlying media.
-
- Other information about the object (such as its modification date) might not be flushed
- by this call, though any volume-level data needed to access the stream will be.
-
-
- */
- /* */
- /* */
- /*
- Function: FSStreamGetMark
- Purpose: Returns the current mark (position offset) for a stream.
- Inputs:
- stream_t The stream.
- Outputs:
- currentMark_o Current offset in the stream, stream_t.
- Notes:
- This call returns the offset from the start of the file that would be
- equivalent to using a FSForkPositionDescriptor whose positionOffset is
- 0, and whose positionMode is kFSFromMark. A stream's mark is set to
- the byte following the last read or write, or via FSStreamSetMark.
- */
- /* */
- /* */
- /* */
- /* */
- /* */
- /*
- Function: FSStreamSetMark
- Purpose: Sets the current mark (position offset) for a stream.
- Inputs:
- stream_t The stream.
- newPosition_i The new position of the stream's mark.
- options_i
- Outputs:
- originalMark_o The stream's mark, before being changed (relative
- to the start of the stream).
- currentMark_o The new mark, relative to the start of the stream.
- Notes:
- A stream's mark is usually used for sequential access to a stream,
- or to position relative to the ending position of the last operation
- on a stream. This call lets you explicitly set the mark for future
- operations that will operate relative to the current mark.
-
- If kFSMarkPinToEOF is set in options_i, and the new position specified
- by newPosition_i would exceed the current end of the stream (also known
- as End Of File or EOF), then the mark will be set to the EOF and E_NoError
- is returned. Otherwise, an error will returned. The mark may never be
- set past the end of the stream.
-
-
- */
- /* */
- /* */
- /*
- ============================================================================
- Memory-mapped Access Method(Backing Store Requests)
- ============================================================================
- */
- /*
- Function: FSMappedFileClose
- Purpose: Closes an access path to a file used for backing store.
- Inputs:
- backingStore_t The backing store object.
- Outputs:
- Notes:
- Basically the same as FSStreamClose, but for a backing store.
-
- All data written to this backing store (by writing to pages backed by
- this store) will be flushed (written) by the File Manager.
- */
- /*
- Function: FSMappedFileGetEOF
- Purpose: Return the EOF (length) of the fork being accessed by the given backing store.
- Inputs:
- backingStore_t The backing store used to access the fork.
- Outputs:
- currentEOF_o The size, in bytes, of the fork.
- Notes:
- Since access to a fork via a backing store (i.e. memory mapped file access) is
- accomplished by directly accessing memory pages, the virtual memory system must
- read and write entire pages. If the last page is modified, the entire page is
- written, resulting in the fork size being rounded up to a multiple of a page size.
- Similarly for access to pages beyond the fork's EOF.
-
- This call returns the current EOF (length) of the underlying fork. This may be
- set implicitly by writing to backed pages, or by using the FSBackingStoreSetEOF
- call. It may also be changed by streams opened to the same fork.
- */
- /* */
- /*
- Function: FSMappedFileSetEOF
- Purpose: Sets the EOF (length) of the fork being accessed by the given backing store.
- Inputs:
- backingStore_t The backing store used to access the fork.
- EOF_i The new length (EOF) of the fork.
- policy_i Controls how space should be allocated (if the new EOF
- is larger than the current EOF).
- Outputs:
- currentEOF_o The new size, in bytes, of the fork.
- Notes:
- Since access to a fork via a backing store (i.e. memory mapped file access) is
- accomplished by directly accessing memory pages, the virtual memory system must
- read and write entire pages. If the last page is modified, the entire page is
- written, resulting in the fork size being rounded up to a multiple of a page size.
- Similarly for access to pages beyond the fork's EOF.
-
- This call allows the EOF to be explicitly set for a fork being accessed via a
- backing store. Any data beyond the EOF will not actually be written to the fork.
- The File Manager has no way to detect whether access to pages occurs beyond the
- EOF; it is a programming error to access bytes beyond the EOF via a backing store.
-
- This call would typically be used when a fork has been memory mapped to enable
- convenient access to a file's data structures as if it were completely in memory.
- You would make all changes to the data structures, then use this call to indicate
- the number of bytes that are valid and should be written to the fork.
- */
- /* */
- /*
- ****************************************************************************
- NAVIGATION & ENUMERATION
- ****************************************************************************
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Iteration
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /**/
- /*
- Function: FSObjectIteratorChangeCurrentScope
- Purpose: Move an object iterator into or out of a container.
- Inputs:
- iterator_t The object iterator.
- movement_i The direction to move: into or out of a container.
- Outputs:
- Notes:
- If movement_i is kFSObjectEnter, then the iterator must be positioned on
- an object that is capable of containing other objects; it does not need to
- actually contain any objects at that time. That object will become the new
- current scope of the iterator and it will be in Start Of Iteration state
- (meaning that all objects in the current scope have yet to be returned).
- The iterator will not be positioned on any object.
-
- If movement_i is kFSObjectExit, then the current scope will become the object
- that contains the current scope; the iterator's new position will be the object
- that was the current scope. If the current scope and the outermost scope were
- the same, then the outermost scope will also change to the new current scope and
- E_ExitIteratorScope is returned (so that you realize you will be iterating outside
- of the scope that you used to create the iterator; the iterator remains usable).
-
- Object iterators keep track of all of the objects between the outermost scope and
- the current scope (this is known as the "scope stack"). If any object in the scope
- stack is moved, the iterator is invalidated and will return the error
- E_IteratorScopeException until it has been explicitly fixed (by FSObjectIteratorRecreate)
- or disposed. This call adds or removes objects from the scope stack.
- */
- /**/
- /*
- Function: FSObjectIteratorCreate
- Purpose: Create an iterator for iterating over objects.
- Inputs:
- outermostScope_t The initial outermost scope and current scope.
- options_i Controls whether the iterator will traverse objects in
- a single container or all embedded (nested) containers.
- Also controls which kinds of objects will be returned.
- Outputs:
- iterator_o The object iterator.
- Notes:
- The outermost scope and current scope of the iterator are set to outermostScope_t.
- The iterator is not positioned on any object, though it is inside outermostScope_t.
- OutermostScope_t must be an object capable of containing other objects (such as the
- Universe, a volume set, a volume, or a folder). The iterator is put into "Start Of
- Iteration" state, meaning that all objects in the current scope have yet to be
- returned.
-
- The File Manager allocates resources and maintains state for every iterator. When
- you have finished using an iterator, you should call FSObjectIteratorDispose to dispose
- of it.
- */
- /*
- Function: FSObjectIteratorDispose
- Purpose: Dispose of an object iterator.
- Inputs:
- iterator_t The object iterator.
- Outputs:
- Notes:
- The File Manager will dispose of the iterator and release any resources
- allocated to the iterator. Further attempts to use the iterator will result
- in an error.
-
-
- */
- /**/
- /**/
- /*
- Function: FSObjectIteratorRestart
- Purpose: Place an object iterator in the Start Of Iterator state, in its current scope.
- Inputs:
- iterator_t The object iterator.
- Outputs:
- Notes:
- The iterator is not positioned on any object. The iterator is put into "Start Of
- Iteration" state, meaning that all objects in the current scope have yet to be
- returned.
-
- You would use this call to completely restart iteration within the current scope,
- ignoring any state about objects previously returned in the current scope. The
- outermost scope is not affected. State information about which objects have been
- returned from scopes outside the current scope is unchanged.
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Resolution
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /*
- Function: FSObjectExchange
- Purpose: Exchange the properties of two objects. Typically used for "safe
- saving", while maintaining an object's persistent reference.
- Inputs:
- object1_i One object.
- object2_i The object to exchange it with.
- Outputs:
- Notes:
- This call is used to allow a "safe save" that preserves an object's
- persistent reference. For example, you might want to save an updated
- set of properties to an object so that any errors while saving result
- in the object being unchanged; but, you also want the object's persistent
- reference to remain unchanged (so that things like aliases still work).
-
- What you would do is create a second object somewhere (in a temporary
- folder, for example). Write out all of the properties, both unchanged
- and changed, to the second object. When done saving, you would call
- FSObjectExchange with both objects; the contents of the two objects get
- swapped in such a way that the original object has the new properties,
- but retains its old persistent reference.
-
-
- */
- /*
- Function: FSObjectRefGetFSSpec
- Purpose: Return an FSSpec for an object (suitable for use with the Files API).
- Inputs:
- object_t The object.
- Outputs:
- fSSpec_o An FSSpec that specifies the same object as object_t,
- suitable for use with the Files API.
- Notes:
- This call is intended to be used by code that is required to use both the
- Files API and the FileManager API (or has clients that use both APIs).
- For example, a piece of code may already exist with an API that uses FSSpecs,
- but has been converted internally to use the FSObjectRefs; it would use this
- call to produce an FSSpec as an output for the pre-existing API.
-
- It would be best to provide an API that allows its clients to use FSObjectRefs.
- */
- /**/
- /**/
- /* */
- /*
- Function: FSSpecGetFSObjectRef
- Purpose: Return an FSObjectRef for an object specified via an FSSpec.
- Inputs:
- theFSSpec_t An FSSpec for the object.
- Outputs:
- theObject_o An FSObjectRef for the object.
- Notes:
- This call is intended to be used by code that is required to use both the
- Files API and the FileManager API (or has clients that use both APIs).
- For example, a piece of code may already exist with an API that uses FSSpecs,
- but has been converted internally to use the FSObjectRefs; it would use this
- call to take an input FSSpec and convert it to an FSObjectRef to use internally;
- the FSObjectRef would then be disposed before completing the call.
-
- It would be best to provide an API that allows its clients to use FSObjectRefs.
- */
- /* */
- /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> F a c i l i t i e s <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
- /*
- ============================================================================
- Cache Flush Routines
- ============================================================================
- */
- /*
- Function: FSObjectFlush
- Purpose: Flushes any data cached by the File Manager for the given object.
- Inputs:
- object_t The object to be flushed.
- Outputs:
- Notes:
- If object_t is a file, then any data written to that file (via a stream or backing store,
- regardless of the process that opened the stream or backing store) will be written by the
- File Manager to any underlying device. If object_t is a volume, then any data written to
- any file on that volume will be flushed.
-
- Any change to properties of object_t will be flushed (regardless of the object's type).
-
- Data about the object (or contained in the object) may still reside in the File Manager's
- caches, but any changes will have been written out by the File Manager. Note that the
- underlying device's driver, or the device itself, may cache some data, so the File Manager
- cannot guarantee that all data has actually been written to the underlying media.
-
-
-
- */
- /*
- ============================================================================
- Request Cancellation Routines
- ============================================================================
- */
- /* */
- /*
- ============================================================================
- Object Property Sizes
- ============================================================================
- */
- /**/
- /**/
- #endif
- #endif
-
- #endif /* __SOMIDL__ */
-
- #endif /* __FILEMANAGERSPI_IDL__ */
-
-